package com.lqian.simplestructure.linearlist;

public class AddOnetoHandread {
    public static void main(String[] args) {
        int sum = 0;
        int end = 100;

        //直接for循环
        for (int i=1;i<=end;i++){  //times:100
            sum +=i;
        }
        //直接计算
        sum = (1 + end)*end/2; // times ：1

        //打印结果
        System.out.println(sum);
    }
}
